# -*- coding: utf-8 -*-

from django.conf.urls import url,include
from  django.conf.urls.static import settings
from  django.conf import  settings
from django.views.static import serve



#reset api接口注册
from . import views
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'product',views.ProductViewSet)

# reset swager
from rest_framework_swagger.views import get_swagger_view

schema_view = get_swagger_view(title='great API')

urlpatterns = [
    url(r'^index$', views.index, name='index'),
    url(r'^user_list$',views.user_list,name='user_list'),
    url(r'^user_add$',views.user_add,name='user_add'),
    url(r'^login$',views.login,name='login'),
    url(r'^logout',views.login,name='logout'),
    url(r'^host_list$',views.host_list,name='host_list'),
    url(r'^update_host_info$',views.update_host_info,name='update_host_info'),
    url(r'^file_down$',views.file_down,name='file_down'),
    url(r'^file_upload', views.file_upload, name='file_upload'),
    url(r'^vpn_manger?', views.vpn_manger, name='vpn_manger'),
    url(r'^vpn_add', views.vpn_add, name='vpn_add'),
    url(r'^vpn_update-(?P<uid>\w+)$', views.vpn_update, name='vpn_update'),
    url(r'^vpn_del-(?P<aid>\w+)$', views.vpn_del, name='vpn_del'),
    url(r'^vpn_search$', views.vpn_search, name='vpn_search'),
    url(r'^students$',views.students,name='views_student_list'),
    url(r'^charts/$',views.charts,name='charts'),
    url(r'^getMonthCharts/$',views.getMonthCharts,name='getMonthCharts'),
    url(r'^getPersonCharts/$',views.getPersonCharts,name='getPersonCharts'),

    url(r'^rem_exec$',views.rem_exec,name='rem_exec'),
    url(r'^user_del-(?P<gid>\d+)$', views.user_del, name='user_del'),
    url(r'^user_edit-(?P<eid>\d+)$', views.user_edit, name='user_edit'),
    url(r'^(?P<question_id>[0-9]+)',views.detail,name='detail'),
	#/blog/55/detail   =====> detail(request=<HttpRequest object>, question_id='34')，question_id='34'部分来自(?P<question_id>[0-9]+)。使用模式周围的括号“捕获”该模式匹配的文本，并将其作为参数发送到视图函数；?P<question_id> 定义一个名字，它将用于标识匹配的模式；[0-9]+是匹配一串数字的正则表达式。
    url(r'^add$',views.add,name='add'),
    # url(r'^add2/(\d+)/(\d+)$',views.add2,name='add2'),
    url(r'^add2',views.add2,name='add2'),
    # url(r'^terminal/$', views.web_terminal,name='terminal'),
    url(r'^orm',views.orm,name='orm'),
    # url(r'^page', page.page, name='page'),
    url(r'^ajax_add',views.ajax_add,name='ajax_add'),
    url(r'^file_download', views.file_download, name='file_download'),
    url(r'authenticate',views.authenticateEntry,name='loginAuthenticate'),
    url(r'webssh',views.webssh,name='webssh'),
    url(r'connecthost',views.connecthost,name='connecthost'),
    url(r'userlog',views.userlog,name='userlog'),
    url(r'nav',views.nav,name='nav'),
    url(r'redis_manger',views.redis_manger,name='redis_manger'),
    url(r'redis_set',views.redis_set,name='redis_set'),
    url(r'redis_del',views.redis_del,name='redis_del'),

    url('ud2', views.ud2,name='ud2'),
    url(r'^doc/', include(router.urls)),
    url(r'^swagger', schema_view),
    url(r'ftp_file_upload',views.ftp_file_upload),
    url(r'ftp_upload',views.ftp_upload),
    url(r'FileUploads/',views.FileUploads),
    url(r'^static/(?P<path>.*)$', serve, {
        'document_root': settings.STATIC_ROOT,
    }),
    url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),

]
